﻿
using System;
using System.Data;
using System.Web.Script.Serialization;

namespace JSExcel
{
    public class RTData<T>
    {
        /// <summary>数据状态</summary>
        public string Status { get; set; }

        /// <summary> 数据内容。 </summary>
        public T Message { get; set; }
        
        public override string ToString()
        {
            try
            {
                return new JavaScriptSerializer().Serialize(this);
            }
            catch (Exception e) {
                RTData<string> rd = new RTData<string>();
                rd.Status = "error";
                rd.Message = e.Message;
                return new JavaScriptSerializer().Serialize(rd);
            }
        }
        
    }
    public class RTStatus
    {
        public static string Success = "success";
        public static string Error = "error";
    }

}
